<template>
	<view>
		<view class="top-tip">演示预览模式下仅展示设置的内容样式。填写内容、图片、视频、文件等均不保存。</view>
		<preview-form ref="preview" :dataList="list" @dataListChange="dataListChange"  @resultChange="resultChange"></preview-form>
		<view class="bottom-btn" @tap="submit" v-if="showSubmitStatus == true">立即提交</view>
		<view class="m-bottom"></view>
	</view>
</template>

<script>
	import previewForm from "@/components/diy-form/preview-form.vue";
	
	export default {
		components:{
			previewForm,
		},
		data() {
			return {
				list:[],
				resData:[],
				isUploadList:{},
				showSubmitStatus:true,
			}
		},
		methods: {
			submit(){
				//this.$refs.preview.uploadFile(); //检测上传文件
				//var resData = this.$refs.preview.getFormData(); //获取最终数据方法
				var check = this.$refs.preview.checkFormData();  //检测填写数据是否完善
				/* var resData = this.$refs.preview.getFormData(); //获取最终数据方法
				console.log(resData) */
				if(check == true)
				{
					this.$api.msg('预览模式下无法提交');
				}
			},
			dataListChange(data){
				
			},
			resultChange(data){
				//console.log('resultData变化',this.resData)
			}
		},
		onLoad() {
			var list = uni.getStorageSync('common-preview-cache-data');
			
			uni.removeStorageSync('common-preview-cache-data');
			this.list = list?list:[];
		}
	}
</script>

<style lang="scss">
	.top-tip{
		width: 96%;
		margin: 20rpx 3% 0 3%;
		background: #ffffff;
		padding: 20rpx;
		border-radius: 20rpx;
		font-size: 26rpx;
		text-align: center;
		color: #ea0c0c;
	}
	.m-bottom{
		height: 200rpx;
		width: 100%;
	}
	.bottom-btn{
		letter-spacing: 6rpx;
		height: 80rpx;
		width: 60%;
		background: #61B080;
		margin: 100rpx 20%;
		line-height: 80rpx;
		border-radius: 30rpx;
		text-align: center;
		margin-bottom: 30rpx;
		color: #ffffff;
		font-size: 30rpx;
		position: fixed;
		left: 0;
		z-index: 102;
		bottom: 0;
	}
</style>
